/**
  forEach     
  map         
  where       
  any
  every
 */

void main() {
  List list = ['苹果', '香蕉', '西瓜', '橘子'];
  // for(var i=0;i<list.length;i++) {
  //   print(list[i]);
  // }

  // for(var item in list) {
  //   print(item);
  // }

  list.forEach(( value) {
    print(value);
  });

  List list1 = [1, 2, 3, 4, 5, 6];
  var list2 = list1.map((e) => e*e); //(1, 4, 9)
  print(list2.toList()); //[1, 4, 9]

  var list3 = list1.where((e) => e > 3); //(4, 5, 6)
  print(list3.toList()); //[4, 5, 6]


  //只要集合有满足条件的返回true
  var any = list1.any((e) => e>4);
  print(any);

  //每一个都满足添加返回true，否则返回false
  var every = list1.every((e) => e>4);
  print(every);

  var set = new Set();
  set.addAll([111,222,333]);
  set.forEach((element) => print(element));

  var kayson = new Map();
  kayson['name'] = 'Kayson';
  kayson['age'] = 1;
  kayson['sex'] = '男';
  kayson.forEach((key, value) {
    print('$key---$value');
  });

}